DATA502_Final_Project

Author

Jesse DeBolt & Isaac Johnson

Published

December 1, 2022

Prep

library(tidyverse)
library(plotly)
library(gapminder)
library(ggrepel)
library(RColorBrewer)

Reading in original data

Food_Supply_kcal <- read.csv("..\\data\\Food_Supply_kcal_Data.csv", header = TRUE)

kcal_continents_trimmed <- read.csv("..\\data\\kcal_continent_trimmed.csv", header = TRUE)

Creating outlier groups

usa <- kcal_continents_trimmed %>% 
  filter(Country == 'United States')
slovakia <- kcal_continents_trimmed %>% 
  filter(Country == 'Slovakia')
nigeria <- kcal_continents_trimmed %>% 
  filter(Country == 'Nigeria')

Creating country groups

Europe <- kcal_continents_trimmed %>% 
  filter(Continent == 'Europe')
NorthAmerica <- kcal_continents_trimmed %>% 
  filter(Continent == 'North America')
SouthAmerica <- kcal_continents_trimmed %>% 
  filter(Continent == 'South America')
Africa <- kcal_continents_trimmed %>% 
  filter(Continent == 'Africa')

Americas <- kcal_continents_trimmed %>% 
  filter(Continent == 'North America' | Continent == 'South America')

All with no labels

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, color=Continent, text=paste(Country)))+
  scale_color_brewer(palette="Dark2")+
  geom_point(alpha=0.35, aes(size=(Deaths*1000)))+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+

  #US and high/low outliers
  # geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats), 
  #            color = "#E7298A", size=5)+
  #   geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats, 
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = -4.75, nudge_y = -1.0)+
  # geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#7570B3", size=4)+
  #   geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = 2.75, nudge_y = -0.5)+
  # geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#1B9E77")+
  #   geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4, 
  #                   nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.

Europe

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, text=paste(Country)))+
  #scale_color_brewer(palette="Dark2")+
  geom_point(data = Europe, alpha=0.35, aes(size=(Deaths*1000)),
             color = "#7570B3")+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+
  
  #US and high/low outliers
  # geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats), 
  #            color = "#E7298A", size=5)+
  #   geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats, 
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = -4.75, nudge_y = -1.0)+
  # geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#7570B3", size=4)+
  #   geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = 2.75, nudge_y = -0.5)+
  # geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#1B9E77")+
  #   geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4, 
  #                   nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

Americas

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, text=paste(Country)))+
  #scale_color_brewer(palette="Dark2")+
  geom_point(data = Americas, alpha=0.35, aes(size=(Deaths*1000)),
             color = "#E7298A")+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+
  
  #US and high/low outliers
  # geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats), 
  #            color = "#E7298A", size=5)+
  #   geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats, 
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = -4.75, nudge_y = -1.0)+
  # geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#7570B3", size=4)+
  #   geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = 2.75, nudge_y = -0.5)+
  # geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#1B9E77")+
  #   geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4, 
  #                   nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

Africa

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, text=paste(Country)))+
  #scale_color_brewer(palette="Dark2")+
  geom_point(data = Africa, alpha=0.35, aes(size=(Deaths*1000)), 
             color = "#1B9E77")+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+
  
  #US and high/low outliers
  # geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats), 
  #            color = "#E7298A", size=5)+
  #   geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats, 
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = -4.75, nudge_y = -1.0)+
  # geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#7570B3", size=4)+
  #   geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = 2.75, nudge_y = -0.5)+
  # geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#1B9E77")+
  #   geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4, 
  #                   nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

All with US highlighted

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, color=Continent, text=paste(Country)))+
  scale_color_brewer(palette="Dark2")+
  geom_point(alpha=0.35, aes(size=(Deaths*1000)))+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+

  #US and high/low outliers
  geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#E7298A", size=5)+
    geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -4.75, nudge_y = -1.0)+
  # geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#7570B3", size=4)+
  #   geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4,
  #                   nudge_x = 2.75, nudge_y = -0.5)+
  # geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#1B9E77")+
  #   geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4, 
  #                   nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

All with US and Slovakia highlighted

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, color=Continent, text=paste(Country)))+
  scale_color_brewer(palette="Dark2")+
  geom_point(alpha=0.35, aes(size=(Deaths*1000)))+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+

  #US and high/low outliers
  geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#E7298A", size=5)+
    geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -4.75, nudge_y = -1.0)+
  geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#7570B3", size=4)+
    geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = 2.75, nudge_y = -0.5)+
  # geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
  #            color = "#1B9E77")+
  #   geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
  #                   label = Country), fontface="bold", size=4, 
  #                   nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

All with US, Slovakia, and Nigeria highlighted

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, color=Continent, text=paste(Country)))+
  scale_color_brewer(palette="Dark2")+
  geom_point(alpha=0.35, aes(size=(Deaths*1000)))+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+

  #US and high/low outliers
  geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#E7298A", size=5)+
    geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -4.75, nudge_y = -1.0)+
  geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#7570B3", size=4)+
    geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = 2.75, nudge_y = -0.5)+
  geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#1B9E77")+
    geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

Everything

ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, color=Continent, text=paste(Country)))+
  scale_color_brewer(palette="Dark2")+
  geom_point(alpha=0.35, aes(size=(Deaths*1000)))+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+
  
  #US and high/low outliers
  geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#E7298A", size=5)+
    geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -4.75, nudge_y = -1.0)+
  geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#7570B3", size=4)+
    geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = 2.75, nudge_y = -0.5)+
  geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#1B9E77")+
    geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
                  hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
                  hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
                  vjust=1.15), size=2.8, hjust=0, color ="grey")+
    geom_text(aes(27, mean(Animal.fats), label = "average",
                  vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))+

  #Quadrant labels
  annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
           fontface = "italic", hjust=0)+
  annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
           fontface = "italic", hjust=0)

Plotly finale

veggie_plotly <- ggplot(kcal_continents_trimmed, aes(x=Vegetal.Products, y=Animal.fats,
        size=Deaths, color=Continent, text=paste(Country)))+
  scale_color_brewer(palette="Dark2")+
  geom_point(alpha=0.35, aes(size=(Deaths*1000)))+
    scale_size_continuous(name = "Deaths per 1000")+
    scale_x_continuous(limits = c(27, 48.5))+
  
  #US and high/low outliers
  geom_point(data = usa, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#E7298A", size=5)+
    geom_label_repel(data = usa, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -4.75, nudge_y = -1.0)+
  geom_point(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#7570B3", size=4)+
    geom_label_repel(data = slovakia, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = 2.75, nudge_y = -0.5)+
  geom_point(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats),
             color = "#1B9E77")+
    geom_label_repel(data = nigeria, aes(x=Vegetal.Products, y=Animal.fats,
                    label = Country), fontface="bold", size=4,
                    nudge_x = -1.5, nudge_y = 1.7)+
  
  #Quadrant lines
  geom_vline(xintercept = mean(kcal_continents_trimmed$Vegetal.Products),
             linetype="dotted", size=1, color = "grey")+
    # geom_text(aes(mean(Vegetal.Products), 8.1, label = "veggie consumption",
    #               hjust=0), size=2.8, vjust=1.40, angle=270,color = "grey")+
    # geom_text(aes(mean(Vegetal.Products), 8.1, label = "average", 
    #               hjust=0), size=2.8, vjust=-0.85, angle=270, color = "grey")+
    geom_hline(yintercept = mean(kcal_continents_trimmed$Animal.fats),
               linetype="dotted", size=1, color = "grey")+
    # geom_text(aes(27, mean(Animal.fats), label = "meat consumption",
    #               vjust=1.15), size=2.8, hjust=0, color ="grey")+
    # geom_text(aes(27, mean(Animal.fats), label = "average",
    #               vjust=-0.65), size=2.8, hjust=0, color = "grey")+
  
  theme_minimal()+
  
  #Titles
  ggtitle("Eat your VEGGIES kids!")+
    theme(plot.title = element_text(size=18))+
    theme(plot.title = element_text(face="italic"))+
  labs(y="Animal Fats",
       x="Vegetable Products")+
    theme(axis.title.x = element_text(margin = margin(t=6, b=5), size=13))+
    theme(axis.title.y = element_text(margin = margin(r=5, l=5), size=13))

  #Quadrant labels
  # annotate("text", x=43, y=-0.5, label = "Veggie based diet", size=4,
  #          fontface = "italic", hjust=0)+
  # annotate("text", x=27.5, y=7.4, label = "Meat based diet", size=4,
  #          fontface = "italic", hjust=0)

ggplotly(veggie_plotly, tooltip = "text")
Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
  If you'd like to see this geom implemented,
  Please open an issue with your example code at
  https://github.com/ropensci/plotly/issues

Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
  If you'd like to see this geom implemented,
  Please open an issue with your example code at
  https://github.com/ropensci/plotly/issues

Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
  If you'd like to see this geom implemented,
  Please open an issue with your example code at
  https://github.com/ropensci/plotly/issues